/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gulangyu.manage.mvc;

import com.mycompany.yourtrade.common.DerongVariables;
import com.mycompany.yourtrade.common.RedisService;
import com.mycompany.yourtrade.common.SmsClient;
import com.mycompany.yourtrade.common.UpYunService;
import com.mycompany.yourtrade.model.Shop;
import com.mycompany.yourtrade.service.manage.ShopManageService;
import com.mycompany.yourtrade.service.user.UserService;
import com.qunshang.common.SessionUtils;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author superxg
 */
@Controller
@RequestMapping("/shop")
public class ShopManageController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private UpYunService UpYunService;
    @Autowired
    private UserService userService;
    @Autowired
    private ShopManageService shopManageService;
    @Autowired
    private SmsClient smaClient;
    @Autowired
    private RedisService redisService;
    @Autowired
    private DerongVariables derongVariables;
    
    //商户管理首页
    @RequestMapping(value = "shopInfo", method = RequestMethod.GET)
    public ModelAndView shopInfo(HttpServletRequest request) {
        ModelAndView mv = new ModelAndView("shop/shopInfo");
        //String sellerId = SessionUtils.getSellerId(request);
        Shop shop = shopManageService.getShopBySellerId("4a954fb2-223b-4945-bd82-83e3de8c16c9");
        shop.setIdImageUrl(derongVariables.getDomain() + shop.getIdImageUrl());
        shop.setLicenseUrl(derongVariables.getDomain() + shop.getLicenseUrl());
        mv.addObject("shop", shop);
        return mv;
    }
    @RequestMapping(value = "edit", method = RequestMethod.GET)
    public ModelAndView edit(HttpServletRequest request,String id) {
        ModelAndView mv = new ModelAndView("shop/edit");
        //String sellerId = SessionUtils.getSellerId(request);
        Shop shop = shopManageService.getShopBySellerId("4a954fb2-223b-4945-bd82-83e3de8c16c9");
        shop.setIdImageUrl(derongVariables.getDomain() + shop.getIdImageUrl());
        shop.setLicenseUrl(derongVariables.getDomain() + shop.getLicenseUrl());
        mv.addObject("shop", shop);
        return mv;
    }
}
